package com.meatball.core.config

import java.time.Duration
import java.time.Instant

// token前缀
const val TOKEN = "token:"
const val AUTHORIZATION = "Authorization"
const val BEARER = "Bearer "

// 权限提示
const val  UNAUTHORIZED = "权限不足"
const val USERNAME_OR_PASSWORD_INCORRECT = "用户名或密码错误"

// 数据提示
const val ROLE_NAME_EXISTS = "角色名称已经存在"
const val USERNAME_EXISTS = "用户名已经存在"
const val DATA_ALREADY_EXISTS = "数据已经存在"
const val TARGET_AND_RESOURCE_MISMATCH = "目标ID与资源ID不匹配"

/**
 * TODO 返回两个时间之间的秒数
 *
 * @param time
 * @return
 */
fun calculateTimeDifference(time: Instant): Long {
    // 当前时间
    val start = Instant.now()
    return Duration.between(start, time).seconds
}